import { Route } from 'react-router';
import { WeaLocaleProvider } from 'ecCom';
import stores from './stores';
import "./style/index";
import Home from './components/Home';

import ContractCreate from './components/bills/contractCreate';
import MyContract from './components/ledger/MyContract';
import Ledger from './components/ledger/index';
import ContractTypeReport from './components/report/ContractTypeReport';
import ContractStatusReport from './components/report/ContractStatusReport';
import ContractDeptReport from './components/report/ContractDeptReport';
import ContractStaffReport from './components/report/ContractStaffReport';
import ContractPayPlanYOYReport from './components/report/ContractPayPlanYOYReport';
import ContractRevPlanReport from './components/report/ContractRevPlanReport';
import ContractPayPlanReport from './components/report/ContractPayPlanReport';
import ContractRevdAndPaidReport from './components/report/ContractRevdAndPaidReport';
import ContractIncomExceedReport from './components/report/ContractIncomExceedReport';
import ContractPayExceedReport from './components/report/ContractPayExceedReport';
import ContractTop10DeptReport from './components/report/ContractTop10DeptReport';
import ContractTop10PersonReport from './components/report/ContractTop10PersonReport';
import ContractTop10FocusReport from './components/report/ContractTop10FocusReport';

import Template from './components/engine/Template';

const getLocaleLabel = WeaLocaleProvider.getLocaleLabel.bind(this, 'contract');
window.contract_store = stores;

class Error extends React.Component {
    render() { 
		return (
			<WeaErrorPage msg="对不起，无法找到该页面！" />
		)
    }
}

const Routes = (
	<Route path='contract' name="contract" breadcrumbName="合同" onEnter={getLocaleLabel} component={Home}>
		<Route path="bills/create" component={ContractCreate}/>
		<Route path="ledger/home" component={MyContract}/>
        <Route path="ledger/:page" component={Ledger}/>
		<Route path="report/type" component={ContractTypeReport}/>
		<Route path="report/status" component={ContractStatusReport}/>
		<Route path="report/dept" component={ContractDeptReport}/>
		<Route path="report/staff" component={ContractStaffReport}/>
		<Route path="report/plan" component={ContractPayPlanYOYReport}/>
		<Route path="report/revplan" component={ContractRevPlanReport}/>
		<Route path="report/payplan" component={ContractPayPlanReport}/>
		<Route path="report/incompay" component={ContractRevdAndPaidReport}/>
		<Route path="report/incomexceed" component={ContractIncomExceedReport}/>
		<Route path="report/payexceed" component={ContractPayExceedReport}/>
		<Route path="report/top10dept" component={ContractTop10DeptReport}/>
		<Route path="report/top10person" component={ContractTop10PersonReport}/>
		<Route path="report/top10focus" component={ContractTop10FocusReport}/>

		<Route path="engine/template" component={Template}/>
	</Route>
);

module.exports = {
	Route: Routes,
	store: stores
};
